package top.humbleyuan.designmode.singleton;


import java.util.HashSet;
import java.util.Set;

/**
 * @Author HumbleYuan
 * @Date 2019/10/9 17:07
 * @Des 双重检查锁
 * DCL（Double check lock）
 */
public class DuplicationCheckSingleton {


    private volatile static DuplicationCheckSingleton singleton = null;

    private DuplicationCheckSingleton() {}

    public static DuplicationCheckSingleton getSingleton() {
        if(singleton == null) {
            synchronized (DuplicationCheckSingleton.class) {
                if(singleton == null)
                    singleton = new DuplicationCheckSingleton();
            }
        }
        return  singleton;

    }


}
